package com.qys.livesMall.financial.controller.app;

import com.qys.livesMall.common.result.R;
import com.qys.livesMall.financial.model.dto.app.AppFinancialOfflineUserDTO;
import com.qys.livesMall.financial.service.FinancialOfflineUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户完成线下理财信息 前端控制器
 * </p>
 *
 * @author
 * @since 2023-06-10
 */
@RestController
@Tag(name = "APP-用户线下理财信息")
@RequestMapping("/app/financial/offline/user")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppFinancialOfflineUserController {

    private final FinancialOfflineUserService offlineUserService;

    @PostMapping("/finish/task")
    @Operation(summary = "用户完成任务")
    public R<Void> finishTask(@RequestBody AppFinancialOfflineUserDTO dto) {
        offlineUserService.finishTask(dto);
        return R.ok();
    }

    /**
     * 首次提现需要完成线下理财数量判断是否完成
     */
    @GetMapping("/withdrawalCheck/{userId}")
    @Operation(summary = "提现前检查")
    public R<?> withdrawalCheck(@PathVariable Long userId){
       return offlineUserService.withdrawalCheck(userId);
    }
}
